{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>研学详情</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">标题：</label>
                            <div class="layui-input-block">
                                <input type="text" name="n_title" value="{$res['n_title']}" lay-verify="required" placeholder="标题" class="layui-input" disabled>
                            </div>
                        </div>
                        <!--<div class="layui-form-item layui-col-md-offset1 layui-col-md8">-->
                        <!--<label class="layui-form-label">活动人数：</label>-->
                        <!--<div class="layui-input-block">-->
                        <!--<input type="text" name="num" lay-verify="required" placeholder="活动人数" class="layui-input ">-->
                        <!--</div>-->
                        <!--</div>-->
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">报名费用：</label>
                            <div class="layui-input-block">
                                <input type="text" name="money" value="{$res['n_money']}" lay-verify="required" placeholder="报名费用" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">报名开始时间：</label>
                            <div class="layui-input-block">
                                <input type="text"  name="start" value="{$res['n_apply_start_time']}" class="layui-input layer-date search" placeholder="报名开始日期" disabled/>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">报名结束时间：</label>
                            <div class="layui-input-block">
                                <input type="text"  name="end" value="{$res['n_apply_end_time']}" class="layui-input layer-date search" placeholder="报名结束日期" disabled/>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">活动开始时间：</label>
                            <div class="layui-input-block">
                                <input type="text"  name="start1" value="{$res['n_start_time']}" class="layui-input layer-date search" placeholder="报名开始日期" disabled/>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">活动结束时间：</label>
                            <div class="layui-input-block">
                                <input type="text"  name="end1" value="{$res['n_end_time']}" class="layui-input layer-date search" placeholder="报名结束日期" disabled/>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">联系人：</label>
                            <div class="layui-input-block">
                                <input type="text" name="n_user" value="{$res['n_linkman']}" lay-verify="required" placeholder="联系人(中间以英文逗号分隔)" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">联系电话：</label>
                            <div class="layui-input-block">
                                <input type="text" name="n_phone" value="{$res['n_phone']}" lay-verify="required" placeholder="联系电话(中间以英文逗号分隔)" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">内容：</label>
                            <div class="layui-input-block" id="LAY_editor" lay-verify="editor">
                                <p>{$res['n_content']}</p>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">缩略图：</label>
                            <img src="{$res['n_thumb']}" style="width: 200px;height:200px">
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">封面图：</label>
                            <img src="{$res['n_img']}" style="width: 200px;height:200px">
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">适用学校：</label>
                            <div class="layui-input-block">
                                <select name="n_school" xm-select="select1" lay-verify="required" xm-select-search="" disabled>
                                    {foreach name="school" item="vo"}
                                    <option value="{$vo.school_id}" {if in_array($vo['school_id'],$res['school'])}selected{/if}>{$vo.school_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    var editor = wk.wang({elem:'#LAY_editor'});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.verify({
            editor:function(value,item){
                if(editor.txt.html() == '<p><br></p>'){
                    return '请填写内容';
                }
            }
        });
        form.on('submit(component-form-element)', function (data) {
            data.field.n_content = editor.txt.html();
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('add')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('curriculum/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>

</body>
</html>
